CXXFLAGS = -g -Wall -pedantic

all: bbserv

main.o: main.cpp
	$(CXX) $(CXXFLAGS) -c -o main.o main.cpp

bulletinboard.o: bulletinboard.h bulletinboard.cpp
	$(CXX) $(CXXFLAGS) -c -o bulletinboard.o bulletinboard.cpp

config.o: config.h config.cpp
	$(CXX) $(CXXFLAGS) -c -o config.o config.cpp

replica.o: replica.h replica.cpp
	$(CXX) $(CXXFLAGS) -c -o replica.o replica.cpp

tcp-utils.o: tcp-utils.h tcp-utils.cpp
	$(CXX) $(CXXFLAGS) -c -o tcp-utils.o tcp-utils.cpp

utils.o: utils.h utils.cpp
	$(CXX) $(CXXFLAGS) -c -o utils.o utils.cpp

writebuffer.o: writebuffer.h writebuffer.cpp
	$(CXX) $(CXXFLAGS) -c -o writebuffer.o writebuffer.cpp

bbserv: main.o bulletinboard.o config.o replica.o tcp-utils.o utils.o writebuffer.o
	$(CXX) $(CXXFLAGS) -lpthread -o bbserv main.o bulletinboard.o config.o replica.o tcp-utils.o utils.o writebuffer.o

clean:
	rm -f bbserv *~ *.o *.bak core \#*
